﻿/*
 * HttpFile.h
 *
 */
#ifndef __GDK_HTTPFILE_H__
#define __GDK_HTTPFILE_H__

#include <gdk/core/Types.h>
#include <gdk/core/String.h>
#include <gdk/core/Archive.h>
#include <gdk/net/NetArchive.h>


namespace gdk
{



	/////////////////////////////////////////////////
	class GDK_NET_EXPORT HttpFile : public NetArchive
	{
		DECLARE_CLASS_HANDLE(HttpFile)
		DECLARE_CLASS_INSTANCE(HttpFile)

	private:
		String		_proxy;
		String		_proxyHost;
		uint16_t	_proxyPort;

		String		_proxyUserName;
		String		_proxyPassword;

	private:
		HttpFile(void);
		~HttpFile(void);

	public:
		virtual bool open(const String &url, ssize_t beginPos = 0);
		virtual void close(void);

	public:
		void setProxy(const String &proxy);
		void setProxyAuth(const String &userName, const String &password);

	public:
		__INLINE__ bool  isProxy(void) const { return (!_proxy.empty()); }
		__INLINE__ const String& getProxy(void) const { return _proxy; }
		__INLINE__ const String& getProxyHost(void) const { return _proxyHost; }
		__INLINE__ uint16_t getProxyPort(void) const { return _proxyPort; }
		__INLINE__ const String& getProxyUserName(void) const { return _proxyUserName; }
		__INLINE__ const String& getProxyPassword(void) const { return _proxyPassword; }

	};

}


#endif /* __GDK_HTTPFILE_H__ */
